<template>
  <el-card class="attr-card">
    <div class="flex-center">
      <span class="label">{{ label }}：</span>
      <el-button v-if="canEdit" type="text" @click="edit">修改</el-button>
    </div>
    <div class="value">{{ value }}</div>
  </el-card>
</template>

<script>
export default {
  name: "AttrCard",
  props: {
    label: String,
    value: [String | Object],
    canEdit: Boolean,
    attrKey: String,
    unit: String
  },
  methods: {
    edit() {
      this.$emit('edit', {...this.$props})
    }
  }
}
</script>

<style lang="scss" scoped>
.attr-card {
  width: 300px;

  .label {
    font-size: 14px;
    margin-bottom: 10px ;
  }

  .value {
    font-weight: 600;
    font-size: 18px;
    word-break: break-word;
  }
}
</style>
